package com.cs.command1;

/**
 * @author Sam.Lee E-mail:lishanman2007@163.com
 * @version Created：Aug 31, 2011 3:11:02 PM
 */
public class Waiter {
	private MenuCommand menuCommand = new MenuCommand();

	public void orderDish(Command command) {
		if (command instanceof ChopCommand) {
			((ChopCommand) command).setCook(new HotCook());
			menuCommand.addCommand(command);
		} else if (command instanceof DuckCommand) {
			((DuckCommand) command).setCook(new HotCook());
			menuCommand.addCommand(command);
		} else if (command instanceof PeanutCommand) {
			((PeanutCommand) command).setCook(new CoolCook());
			menuCommand.addCommand(command);
		}
	}

	public void orderOver() {
		for (Command command : menuCommand.getCommands()) {
			command.execute();
		}
	}
}
